import Vue from "vue"
import App from "./App.vue"
import router from "./router"
import store from "./store"
import axios from "axios"
import $ from 'jquery';
import $http from "./until/axios.js"
import YDUI from "vue-ydui"; /* 相当于import YDUI from "vue-ydui/ydui.rem.js" */
import "vue-ydui/dist/ydui.rem.css";
import Mint from "mint-ui";
import 'mint-ui/lib/style.css'
import './style/font/iconfont.css'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.prototype.axios = axios;
Vue.prototype.$http = $http;

Vue.use(ElementUI)
Vue.use(Mint);
Vue.use(YDUI);
if (/android/i.test(navigator.userAgent)) {
    localStorage.setItem("sys", "Android");
} else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
    localStorage.setItem("sys", "IOS");
}
/*动态设置 :root的font-size*/
(function (doc, win) {
    var docEl = doc.documentElement,
        resizeEvt = "orientationchange" in window ? "orientationchange" : "resize",
        recalc = function () {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            docEl.style.fontSize = clientWidth * 75 / 750 + "px";
        };

    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    doc.addEventListener("DOMContentLoaded", recalc, false);
})(document, window);

Vue.config.productionTip = false
router.afterEach((to, from) => {
  if(to.path.indexOf('index')>=0||to.path.indexOf('takephoto')>=0){
    store.commit('setCurrentActive',0);
  }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app")
